//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
    public static void main(String[] args) {
        for(int i = 0;i<1000;++i){
            if(func_(i))
                System.out.printf("%d ",i);
        }
        System.out.println();
    }
    public static boolean func_(int num){
        int sum = 0;
        for(int i = 1;i<num;++i){
            if(num%i == 0){
                sum+=i;
            }
        }
        return sum == num;
    }
}